import dayjs from 'dayjs'

// 时间格式化
const formatDate = (date, formatType) => {
    const dateObj = new Date(date);
    const monthDay = dayjs(date).format("M月D日")
    const month = String(dateObj.getMonth() + 1).padStart(2, '0');
    const day = String(dateObj.getDate()).padStart(2, '0');
    const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][dateObj.getDay()];

    switch (formatType) {
        case 'day':
            return monthDay;
        case 'week':
            return week;
        default:
            return '';
    }
};

export default formatDate;